1 <?php
2 session_start();
// Use session variable on this page. This function must put on the top of page.
3 if
(!isset($_SESSION['username']) || $_SESSION['usertype'] !='admin'){ // if session variable "username" does not exist.
4 header(
"location:index.php?msg=Please%20login%20to%20access%20admin%20area%20!"); // Re-direct to index.php
5 }

6 else

7 {
8     include_once
"db.php";
9     error_reporting (E_ALL ^ E_NOTICE);
10
11 ?><!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
12 "http:
//www.w3.org/TR/html4/loose.dtd">
13 <html>
14 <head>
15 <title>Welcome to Stock Management System !</title>
16 <meta http-equiv=
"Content-Type" content="text/html; charset=iso-8859-1">
17 <link rel=
"stylesheet" href="css/validationEngine.jquery.css" type="text/css" media="screen" title="no title" charset="utf-8" />
18         <link rel=
"stylesheet" href="css/template.css" type="text/css" media="screen" title="no title" charset="utf-8" />
19         <script src=
"js/jquery.min.js" type="text/javascript"></script>
20         
21         
22
23         <script src=
"js/jquery.validationEngine-en.js" type="text/javascript"></script>
24         <script src=
"js/jquery.validationEngine.js" type="text/javascript"></script>
25          <script src=
"js/jquery.hotkeys-0.7.9.js"></script>
26         <!-- AJAX SUCCESS TEST FONCTION
27             <script>function callSuccessFunction(){alert(
"success executed")}
28                     function callFailFunction(){alert(
"fail executed")}
29             </script>
30         -->
31         
32         <script>
33         
34         
35         
36         
37         
38         $(document).ready(function() {
39             
// SUCCESS AJAX CALL, replace "success: false," by: success : function() { callSuccessFunction() },
40              $(
"#category").focus();
41             $(
"#form1").validationEngine(),
42             
43             jQuery(document).bind(
'keydown', 'Ctrl+s',function() {
44           $(
'#form1').submit();
45           
return false;
46             });
47             
48             jQuery(document).bind(
'keydown', 'Ctrl+r',function() {
49           $(
'#form1').reset();
50           
return false;
51             });
52             jQuery(document).bind(
'keydown', 'Ctrl+a',function() {
53             window.location =
"add_category.php";
54           
return false;
55             });
56             jQuery(document).bind(
'keydown', 'Ctrl+0',function() {
57             window.location =
"admin.php";
58           
return false;
59             });
60             jQuery(document).bind(
'keydown', 'Ctrl+1',function() {
61             window.location =
"add_purchase.php";
62               
return false;
63             });
64             jQuery(document).bind(
'keydown', 'Ctrl+2',function() {
65             window.location =
"add_stock_sales.php";
66               
return false;
67             });
68             jQuery(document).bind(
'keydown', 'Ctrl+3',function() {
69             window.location =
"add_stock_details.php";
70               
return false;
71             });
72             jQuery(document).bind(
'keydown', 'Ctrl+4',function() {
73             window.location =
"add_category.php";
74               
return false;
75             });
76             jQuery(document).bind(
'keydown', 'Ctrl+5',function() {
77             window.location =
"add_supplier_details.php";
78               
return false;
79             });
80             jQuery(document).bind(
'keydown', 'Ctrl+6',function() {
81             window.location =
"add_customer_details.php";
82               
return false;
83             });
84             jQuery(document).bind(
'keydown', 'Ctrl+7',function() {
85             window.location =
"view_stock_entries.php";
86               
return false;
87             });
88             jQuery(document).bind(
'keydown', 'Ctrl+8',function() {
89             window.location =
"view_stock_sales.php";
90               
return false;
91             });
92             jQuery(document).bind(
'keydown', 'Ctrl+9',function() {
93             window.location =
"view_stock_details.php";
94               
return false;
95             });
96             
//$.validationEngine.loadValidation("#date")
97             
//alert($("#formID").validationEngine({returnIsValid:true}))
98             
//$.validationEngine.buildPrompt("#date","This is an example","error") // Exterior prompt build example // input prompt close example
99             
//$.validationEngine.closePrompt(".formError",true) // CLOSE ALL OPEN PROMPTS
100         });
101     </script>
102 <style type=
"text/css">
103 <!--
104 body {
105     margin-left: 0px;
106     margin-top: 0px;
107     margin-right: 0px;
108     margin-bottom: 0px;
109     background-color: #FFFFFF;
110 }
111
112 *{
113 padding: 0px;
114 margin: 0px;
115 }
116 #vertmenu {
117 font-family: Verdana, Arial, Helvetica, sans-serif;
118 font-size:
100%;
119 width: 160px;
120 padding: 0px;
121 margin: 0px;
122 }
123
124 #vertmenu h1 {
125 display: block;
126 background-color:#FF9900;
127 font-size:
90%;
128 padding: 3px
0 5px 3px;
129 border: 1px solid #
000000;
130 color: #
333333;
131 margin: 0px;
132 width:159px;
133 }
134
135 #vertmenu ul {
136 list-style: none;
137 margin: 0px;
138 padding: 0px;
139 border: none;
140 }
141 #vertmenu ul li {
142 margin: 0px;
143 padding: 0px;
144 }
145 #vertmenu ul li a {
146 font-size:
80%;
147 display: block;
148 border-bottom: 1px dashed #C39C4E;
149 padding: 5px 0px 2px 4px;
150 text-decoration: none;
151 color: #
666666;
152 width:160px;
153 }
154
155 #vertmenu ul li a:hover, #vertmenu ul li a:focus {
156 color: #
000000;
157 background-color: #eeeeee;
158 }
159 .style1 {color: #
000000}
160
161 -->
162 </style>
163 </head>
164
165 <body>
166 <table width=
"100%" border="0" cellspacing="0" cellpadding="0">
167   <tr>
168     <td align=
"center" valign="top"><table width="960" border="0" cellspacing="0" cellpadding="0">
169       <tr>
170         <td><table width=
"960" border="0" cellpadding="0" cellspacing="0" bgcolor="#ECECEC">
171           <tr>
172             <td height=
"90" align="left" valign="top"><img src="images/topbanner.jpg" width="960" height="82"></td>
173           </tr>
174           <tr>
175             <td height=
"800" align="left" valign="top"><table width="960" border="0" cellpadding="0" cellspacing="0" bgcolor="#ECECEC">
176               <tr>
177                 <td width=
"130" align="left" valign="top">
178                 
179                 <br>
180
181                 <strong>Welcome <font color=
"#3399FF"><?php echo $_SESSION['username']; ?> !</font></strong><br> <br>
182 <table width=
"100%" border="0" cellspacing="0" cellpadding="0">
183   <tr>
184     <td align=
"center"><a href="admin.php"><img src="images/home.png" width="130" height="99" border="0"></a></td>
185     </tr>
186   <tr>
187     <td align=
"center">&nbsp;</td>
188     </tr>
189   <tr>
190     <td align=
"center"><a href="add_purchase.php"><img src="images/purchase.png" width="130" height="124" border="0"></a></td>
191     </tr>
192   <tr>
193     <td align=
"center">&nbsp;</td>
194     </tr>
195   <tr>
196     <td align=
"center"><a href="add_stock_sales.php"><img src="images/sales.png" width="146" height="111" border="0"></a></td>
197     </tr>
198   <tr>
199     <td align=
"center">&nbsp;</td>
200     </tr>
201   <tr>
202     <td align=
"center"><a href="report.php"><img src="images/reports.png" width="131" height="142" border="0"></a></td>
203     </tr>
204   <tr>
205     <td align=
"center">&nbsp;</td>
206     </tr>
207   <tr>
208     <td align=
"center">&nbsp;</td>
209     </tr>
210   <tr>
211     <td align=
"center">&nbsp;</td>
212     </tr>
213 </table>
214
215
216     
217                 
218                 
219                 </td> <td height=
"500" align="center" valign="top">
220 <table width=
"100%" border="0" cellspacing="0" cellpadding="0">
221   <tr>
222     <td><a href=
"add_stock_details.php"><img src="images/addstockdetails.png" width="67" height="62" border="0"></a></td>
223     <td><a href=
"add_supplier_details.php"><img src="images/supplier.png" width="67" height="54" border="0"></a></td>
224     <td><a href=
"add_customer_details.php"><img src="images/customer.png" width="67" height="54" border="0"></a></td>
225     <td><a href=
"add_category.php"><img src="images/categories.png" width="67" height="54" border="0"></a></td>
226     <td><a href=
"view_stock_sales.php"><img src="images/vsales.png" width="67" height="54" border="0"></a></td>
227     <td><a href=
"view_stock_entries.php"><img src="images/vpurchase.png" width="67" height="54" border="0"></a></td>
228     <td><a href=
"view_stock_details.php"><img src="images/stockdetails.png" width="67" height="54" border="0"></a></td>
229     <td><a href=
"view_stock_availability.php"><img src="images/savail.png" width="67" height="54" border="0"></a></td>
230      <td align=
"left" valign="top"><a href="view_customer_details.php"><img src="images/customers.png" width="94" height="22" border="0"></a><br> <a href="view_supplier_details.php"><img src="images/suppliers.png" width="94" height="22" border="0"></a><br>
231       <a href=
"view_payments.php"><img src="images/payments.png" width="94" height="22" border="0"></a></td>
232     <td align=
"left" valign="top"><a href="view_stock_sales_payments.php"><img src="images/outstanding.png" width="94" height="22" border="0"></a><br> <a href="view_stock_entries_payments.php"><img src="images/pendings.png" width="94" height="22" border="0"></a><br>
233       <a href=
"logout.php"><img src="images/logout.png" width="94" height="22" border="0"></a></td>
234   </tr>
235 </table>
236 <?php
237                 
if(isset($_POST['category']))
238
239             {
240             
241             $category=mysql_real_escape_string($_POST[
'category']);
242             
243             $count = $db->countOf(
"category_details", "category_name='$category'");
244         
if($count==1)
245             {
246         echo
"<font color=red> Dublicat Entry. Please Verify</font>";
247             }
248             
else
249             {
250                 
251             
if($db->query("insert into category_details(category_name,category_description) values('$category','')"))
252             echo
"<br><font color=green size=+1 >[ $category ] Category Added !</font>" ;
253             
else
254             echo
"<br><font color=red size=+1 >Problem in Adding !</font>" ;
255             
256             }
257             
258             
259             }
260                 
261                 ?>
262                 
263                 <br>
264 <br>
265
266                 
267                 <form name=
"form1" method="post" id="form1" action="">
268                   
269                   <p align=
"center"><strong>Add New Category </strong> </p>
270                   <table width=
"400" border="0" cellspacing="0" cellpadding="0">
271                     <tr>
272                       <td width=
"150">&nbsp;</td>
273                       <td width=
"150">&nbsp;</td>
274                       <td width=
"150">&nbsp;</td>
275                     </tr>
276                     <tr>
277                       <td width=
"150">&nbsp;</td>
278                       <td width=
"150">&nbsp;</td>
279                       <td width=
"150">&nbsp;</td>
280                     </tr>
281                     <tr>
282                       <td width=
"150">Category</td>
283                       <td width=
"150"><input name="category" type="text" id="category" class="validate[required,length[0,100]] text-input" ></td>
284                       <td width=
"150"><input type="submit" name="Submit" value="Add"></td>
285                     </tr>
286                     <tr>
287                       <td width=
"150">&nbsp;</td>
288                       <td width=
"150">&nbsp;</td>
289                       <td width=
"150">&nbsp;</td>
290                     </tr>
291                     <tr>
292                       <td>&nbsp;</td>
293                       <td>&nbsp;</td>
294                       <td>&nbsp;</td>
295                     </tr>
296                   </table>
297                 </form></td>
298               </tr>
299             </table>
300             
301         </td>
302           </tr>
303           <tr>
304             <td height=
"30" align="center" bgcolor="#72C9F4"><span class="style1"><a href="http://www.pluskb.com">Developed by PlusKB Innovations</a></span></td>
305           </tr>
306         </table></td>
307       </tr>
308     </table></td>
309   </tr>
310 </table>
311
312 </body>
313 </html>
314 <?php
315 }
316 ?>


Gõ tìm kiếm nhanh...